import logging
from redis import StrictRedis


class Config(object):
    SECRET_KEY = 'KZtgoZECnZyp/hiU49YHotf2Nv4IGYqF5I7M6K3iClzvTWYtALha9E2i7wgIK78X'
    LOG_LEVEL = logging.DEBUG
    # DEBUG = True
    # 2建立数据库链接
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306/frame'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 3配置redis
    REDIS_HOST='127.0.0.1'
    REDIS_PORT=6379
    # 5实例Session
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT, db=1)
    SESSION_USE_SIGNER = True  # 修改为True之后就必须要是何止 serect_key
    PERMANENT_SESSION_LIFETIME = 3600

class DevelopmentConfig(Config):

    DEBUG = True

class ProductionConfig(Config):
    LOG_LEVEL = logging.ERROR
    DEBUG = False

config={
    "development":DevelopmentConfig,
    "production":ProductionConfig
}

